package com.ruoyi.system.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.WmsInventoryHistory;
import com.ruoyi.system.mapper.WmsInventoryHistoryMapper;
import com.ruoyi.system.service.IWmsInventoryHistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 库存记录Service业务层处理
 *
 * @author ruoyi
 * @date 2025-06-21
 */
@Service
public class WmsInventoryHistoryServiceImpl implements IWmsInventoryHistoryService
{
    @Autowired
    private WmsInventoryHistoryMapper wmsInventoryHistoryMapper;

    /**
     * 查询库存记录
     *
     * @param id 库存记录主键
     * @return 库存记录
     */
    @Override
    public WmsInventoryHistory selectWmsInventoryHistoryById(Long id)
    {
        return wmsInventoryHistoryMapper.selectWmsInventoryHistoryById(id);
    }

    /**
     * 查询库存记录列表
     *
     * @param wmsInventoryHistory 库存记录
     * @return 库存记录
     */
    @Override
    public TableDataInfo<WmsInventoryHistory> selectWmsInventoryHistoryList(WmsInventoryHistory wmsInventoryHistory,PageQuery pageQuery)
    {
        Page<WmsInventoryHistory> page = wmsInventoryHistoryMapper.selectWmsInventoryHistoryList(pageQuery.build(),wmsInventoryHistory);
        return TableDataInfo.build(page);
    }

    /**
     * 新增库存记录
     *
     * @param wmsInventoryHistory 库存记录
     * @return 结果
     */
    @Override
    public int insertWmsInventoryHistory(WmsInventoryHistory wmsInventoryHistory)
    {
        wmsInventoryHistory.setCreateTime(DateUtils.getNowDate());
        return wmsInventoryHistoryMapper.insertWmsInventoryHistory(wmsInventoryHistory);
    }

    /**
     * 修改库存记录
     *
     * @param wmsInventoryHistory 库存记录
     * @return 结果
     */
    @Override
    public int updateWmsInventoryHistory(WmsInventoryHistory wmsInventoryHistory)
    {
        return wmsInventoryHistoryMapper.updateWmsInventoryHistory(wmsInventoryHistory);
    }

    /**
     * 批量删除库存记录
     *
     * @param ids 需要删除的库存记录主键
     * @return 结果
     */
    @Override
    public int deleteWmsInventoryHistoryByIds(Long[] ids)
    {
        return wmsInventoryHistoryMapper.deleteWmsInventoryHistoryByIds(ids);
    }

    /**
     * 删除库存记录信息
     *
     * @param id 库存记录主键
     * @return 结果
     */
    @Override
    public int deleteWmsInventoryHistoryById(Long id)
    {
        return wmsInventoryHistoryMapper.deleteWmsInventoryHistoryById(id);
    }
}
